home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / amiga / gui / prcgntn1.lha / Precognition / source / Valuator.c < prev    next >
C/C++ Source or Header  |  1992-12-23  |  1KB  |  76 lines

  1. /* ==========================================================================
  2. **
  3. **                   Valuator.c
  4. **
  5. ** ⌐1991 WILLISoft
  6. **
  7. ** ==========================================================================
  8. */
  9.  
  10. #include "Valuator.h"
  11. #include "ValuatorClass.h"
  12. #include <proto/exec.h>
  13. #include <proto/intuition.h>
  14. #include <proto/graphics.h>
  15. #include "amigamem.h"
  16.  
  17.  
  18. LONG Value( Valuator *self )
  19. {
  20.    struct ValuatorClass *class;
  21.  
  22.  
  23.    if (class = (struct ValuatorClass *) self->isa)
  24.    {
  25.       if (class->Value)
  26.          return (*class->Value)( self );
  27.    }
  28.    else
  29.       return 0;
  30. }
  31.  
  32. LONG SetValue( Valuator *self, LONG selection )
  33. {
  34.    struct ValuatorClass *class;
  35.  
  36.  
  37.    if (class = (struct ValuatorClass *) self->isa)
  38.    {
  39.       if (class->SetValue)
  40.          return (*class->SetValue)( self, selection );
  41.    }
  42.    else
  43.       return 0;
  44. }
  45.  
  46.  
  47.  
  48. BOOL Valuator_elaborated = FALSE;
  49.  
  50. struct ValuatorClass Valuator_Class;
  51.  
  52. void ValuatorClass_Init( struct ValuatorClass *class )
  53. {
  54.    InteractorClass_Init( (struct InteractorClass *) class );
  55.    class->isa          = InteractorClass();
  56.    class->ClassName    = "Valuator";
  57.    class->Value        = NULL;
  58.    class->SetValue     = NULL;
  59. }
  60.  
  61.  
  62. struct ValuatorClass *ValuatorClass( void )
  63. {
  64.    if (! Valuator_elaborated)
  65.    {
  66.       ValuatorClass_Init( &Valuator_Class );
  67.       Valuator_elaborated = TRUE;
  68.    }
  69.  
  70.    return &Valuator_Class;
  71. }
  72.  
  73. void Valuator_Init( Valuator *self )
  74. {
  75.    Interactor_Init( self );
  76. }